<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width,initial-scale=1">
	<title>Lowin</title>
	<link rel="stylesheet" href="/thinkadmin/public/static/assets/css/auth.css">
	<script src="/thinkadmin/public/static/plugs/layui/layui.all.js"></script>
	  <link rel="stylesheet" href="__ROOT__/static/plugs/awesome/fonts.css?at={:date('md')}">
	<link rel="stylesheet" href="__ROOT__/static/plugs/layui/css/layui.css?at={:date('md')}">
	<link rel="stylesheet" href="__ROOT__/static/theme/css/console.css?at={:date('md')}">
	{block name="style"}{/block}
	<script>window.ROOT_URL = '__ROOT__';</script>
	<script src="__ROOT__/static/plugs/jquery/pace.min.js"></script>
</head>

<body>
	
	<div class="lowin lowin-blue">
		<div class="lowin-brand">
			<img src="/thinkadmin/public/static/assets/img/kodinger.jpg" alt="logo">
		</div>
		<div class="lowin-wrapper">
			<div class="lowin-box lowin-login">
				<div class="lowin-box-inner">
					<form class="form" method="POST" action="{:url('login/index')}" autocomplete="off" enctype="multipart/form-data">
						<p>Sign in to continue</p>
						<div class="lowin-group">
							<label>username <a href="#" class="login-back-link">Sign in?</a></label>
							<input type="text" required autocomplete="username" name="username" class="lowin-input">
						</div>
						<div class="lowin-group password-group">
							<label>Password <a href="#" class="forgot-link">Forgot Password?</a></label>
							<input type="password" required name="password" autocomplete="current-password" class="lowin-input">
						</div>
						<div class="lowin-group password-group">
							      
							      
							    <label class="inline-block relative">
							        <label>captcha</label>
							        <input class="lowin-input" required pattern="^\S{4,}$" name="verify" maxlength="4" autocomplete="off" placeholder="验证码" title="请输入验证码">
							    </label>
							    <label data-captcha="{:url('admin/login/captcha',[],false)}" data-field-verify="verify" data-field-uniqid="uniqid" data-captcha-type="{$captcha_type}" data-captcha-token="{$captcha_token}"></label>
							
						</div>
						<button class="lowin-btn login-btn">
							Sign In
						</button>

						<div class="text-foot">
							Don't have an account? <a href="" class="register-link">Register</a>
						</div>
					</form>
				</div>
			</div>

			<div class="lowin-box lowin-register">
				<div class="lowin-box-inner">
					<form class="form" method="POST" action="{:url('login/register')}" autocomplete="off" enctype="multipart/form-data">
						<p>Let's create your account</p>
						<!-- <div class="lowin-group">
							<label>Name</label>
							<input type="text" name="name" autocomplete="name" class="lowin-input">
						</div> -->
						<div class="lowin-group">
							<label>Username</label>
							<input type="text" autocomplete="username" name="username" class="lowin-input">
						</div>
						<div class="lowin-group">
							<label>Password</label>
							<input type="password" name="password" autocomplete="current-password" class="lowin-input">
						</div>
						<div class="lowin-group">
							<label>Password</label>
							<input type="password" name="password_confirm" autocomplete="current-password_confirm" class="lowin-input">
						</div>
						<button class="lowin-btn" name="btn-success" onclick="ajaxPost()" type="submit">
							Sign Up
						</button>

						<div class="text-foot">
							Already have an account? <a href="" class="login-link">Login</a>
						</div>
						<div class="error alert alert-danger" style="display:none" name="error"> 必须要输入点什么吧</div>
						<div class="success alert alert-success" style="display:none" name="success"> 成功了</div>
					</form>
					 <div id="content">
					</div>

				</div>
			</div>
		</div>
	
		<footer class="lowin-footer">

		</footer>
	</div>
	  <script src="/thinkadmin/public/static/assets/js/jquery.js"></script>
	   <script src="/thinkadmin/public/static/assets/js/jquery.min.js"></script>
	<script src="/thinkadmin/public/static/assets/js/jquery.cookie.js"></script>
	<script src="/thinkadmin/public/static/assets/js/dialog/layer.js"></script>
		<script src="/thinkadmin/public/static/plugs/layui/layui.all.js"></script>
	<script src="/thinkadmin/public/static/assets/js/dialog.js"></script>
	<script src="/thinkadmin/public/static/assets/js/auth.js"></script>
	<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1">

<script src="/thinkadmin/public/static/plugs/require/require.js"></script>
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1">
<script>if (location.href.indexOf('#') > -1) location.replace(location.href.split('#')[0])</script>
<link rel="stylesheet" href="__ROOT__/static/theme/css/login.css">

<script src="/thinkadmin/public/static/admin.js"></script>

<!-- <script src="__ROOT__/static/login.js"></script> -->
<script src="/thinkadmin/public/static/login.js"></script>
<!-- <script src="/thinkadmin/public/static/plugs/supersized/supersized.3.2.7.min.js"></script> -->

	<script>
		Auth.init({
			login_url: '#login',
			forgot_url: '#forgot'
		});
	</script>
<!-- 	<script>
		$('.lowin-btn').click(function () {
        $.post("{:url('login/register')}", $('.form-horizontal').serialize(), function (result) {
            if (result.code == 1) {
                layer.msg(result.msg, {icon: 1});
            }  else {
                layer.msg(result.msg, {icon: 5});
            }
        }, 'json');
    });

	</script> -->
<!-- 	 <script>
   function ajaxPost(){
    var formData = $("#btn-success").serialize();
    //serialize() 方法通过序列化表单值，创建 URL 编码文本字符串,这个是jquery提供的方法
    $.ajax({
     type:"post",
     url:"{:url('login/register')}",  //数据传输的控制器方法
     data:formData,//这里data传递过去的是序列化以后的字符串
     success:function(data){
      $("#content").append(data);//获取成功以后输出返回值
     }
    });
   }
  </script> -->
  <script>
  $('#btn-success').on('click', function() {
    // 接收传过来的URL，用属性来接收
    var username = $('#username').val();
    var password = $('#password').val();
    var dataString = 'username='+username+'&password='+password;
    // alert(test);
    if(username==''){
      $('.error').show().fadeOut(3000);
    }else{
      // alert(dataString);
      $.ajax({
        url:"login/register",
        type:"POST",
        data:dataString,
        success:function(data){
          $('#success').fadeIn(200).show();
          $('#error').fadeOut(200).hide();
          var obj = JSON.parse(data);
          layui.use('layer', function(){
             var layer = layui.layer;
             layer.alert(obj.msg,{icon:obj.icon},function(index){
                    location.reload();//重载页面
                    layer.close(index);
              });
          });
        }
      });
    }
});
</script>
</body>
</html>